#5 文件编程小项目

f = open("Blowing in the wind.txt", "w")
f.write('How many roads must a man walk down\n'
        'Before they call him a man\n'
        'How many seas must a white dove sail\n'
        'Before she sleeps in the sand\n')
f.close()
f2 = open("Blowing in the wind.txt", "r+")
l = f2.readlines()
l.insert(0,'Blown in the wind\n')
f2.seek(0,0)
f2.writelines(l)
f2.close()
f3 = open("Blowing in the wind.txt", "r+")
l = f3.readlines()
l.insert(1,'--Bob Dylan\n')
f3.seek(0,0)
f3.writelines(l)
f3.close()

f4 = open('Blowing in the wind.txt', 'a')
f4.write('1962 by Warner Bros.lns')
f4.close()

with open('Blowing in the wind.txt', 'r') as f:
    print(f.read())
f.close()
